home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / backup / kbackup-.000 / KBackup-1.2.7.tar / KBackup / src / write_data_src < prev   
Text File  |  1996-03-27  |  2KB  |  69 lines

  1. #
  2. # /home/kbackup/.CVSROOT/KBackup/src/write_data_src,v 1.10 1996/03/27 20:03:38 kbackup Exp
  3. #
  4. # This file is Copyright (C) 1995 by Karsten Ballⁿder
  5. #                Karsten.Ballueder@stud.uni-karlsruhe.de
  6. #
  7. # It is part of the KBackup package, see the file COPYING for details.
  8. #
  9. #
  10. #    function to reliably write data to tape, including double buffering
  11. #    and multi-volume handling
  12. #
  13.  
  14. WriteData_src_loaded=YES
  15.  
  16. write_data()
  17. {
  18.     if [ "$1" = "-raw" ]
  19.     then
  20.         shift
  21.         if [ "$1" != "" ]
  22.         then
  23.             wdfile="$1"
  24.         else
  25.             wdfile="$device"
  26.         fi
  27.         multibuf_cmd=`echo dd of=$wdfile bs=2048`
  28.     else
  29.         if [ "$1" != "" ]
  30.         then
  31.             wdfile="$1"
  32.         else
  33.             wdfile="$device"
  34.         fi
  35.         if [ "$use_multibuf" = "YES" ]
  36.         then
  37.             set_multibuf_options WRITE
  38.             multibuf_cmd=`echo $MULTIBUF $multibuf_options -b $multibuf_blksize -n $multibuf_nblocks "$wdfile" `
  39.         else
  40.             multibuf_cmd=`echo dd of=$wdfile bs=2048 `
  41.         fi
  42.     fi    
  43.     
  44.  
  45.     if [ "$remote_mode" = "YES" ]
  46.     then
  47.         
  48.         if [ "$double_buffering" = "YES" ]
  49.         then
  50.             last_command="su in write_data()"
  51.             su $remote_uid -c "rsh $remote_host \"$DD  ibs=$multibuf_blksize conv=sync obs=$ddbufsize \
  52.             | $multibuf_cmd \""
  53.         else
  54.             last_command="su in write_data()"
  55.             su $remote_uid -c "rsh $remote_host \"$DD ibs=$multibuf_blksize conv=sync | $multibuf_cmd \""
  56.         fi
  57.     else
  58.         if [ "$double_buffering" = "YES" ]
  59.         then
  60.             last_command="$DD and multibuf in write_data()"
  61.             $DD ibs=$multibuf_blksize conv=sync obs=$ddbufsize | `echo $multibuf_cmd` 2>$STDERR
  62.         else
  63.             last_command="$DD and multibuf in write_data()"
  64.             $DD ibs=$multibuf_blksize conv=sync | `echo $multibuf_cmd` 2>$STDERR
  65.         fi
  66.     fi
  67. }
  68.  
  69.